/*
 * Copyright (c) 2025, 大连理工大学 (Dalian University of Technology)
 *
 * Licensed under the Mulan PSL v2.
 * You can use this file according to the terms and conditions of the Mulan PSL v2.
 * You may obtain a copy of the License at
 *
 *     http://license.coscl.org.cn/MulanPSL2
 *
 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
 * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. SEE THE MULAN PSL v2
 * FOR MORE DETAILS.
 */

#pragma once

#include "DataStructure/Common/Id.h"
#include "DataStructure/Common/Out.h"
#include "DataStructure/Common/Status.h"

#include "DBManager/IRepository/Base/IRepository.h"

/**
 * @brief   : Load数据接口，具有sid
 * @tparam T
 * @author  : wxc
 * @date    : 2024.10.24
 */
template <typename T>
class ISetRepository : public IRepository
{
  public:
    using DataType = T;

    ISetRepository () : IRepository ()
    {}

    virtual ~ISetRepository () = default;

    /// @brief 获取总数
    /// @return
    virtual std::size_t Size () = 0;

    /// @brief 根据sid获取数量
    /// @param sid
    /// @return
    virtual std::size_t Count (SG::DataStructure::Common::Id sid) = 0;

    /// @brief 添加数据
    /// @param entity
    virtual SG::DataStructure::Common::Status Add (T& entity) = 0;

    /// @brief 使用vector批量添加数据
    /// @param entity
    virtual SG::DataStructure::Common::Status Add (std::vector<T>& entity) = 0;

    /**
     * @brief   : 根据Index获取数据
     * @param   : index
     * @param   : entity
     * @return  : 是否查询成功
     * @author  : wxc
     * @date    : 2024.10.28
     */
    virtual SG::DataStructure::Common::Status FindByIndex (std::size_t index, T& _OUT entity) = 0;

    /**
     * @brief   : 查询指定 `loadcase` 下的
     * @param   : Loadcase
     * @param   : arrs
     * @return  : 是否查询成功
     * @author  : wxc
     * @date    : 2024.10.28
     */
    virtual SG::DataStructure::Common::Status FindBySId (SG::DataStructure::Common::Id sId, std::vector<T>& _OUT arrs) = 0;
};
